<!DOCTYPE>
<html>
<head>
<title>Q.ajax Q.ajaxc | Q.js</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 使用QLib控件是必须包含样式表 -->
<link type="text/css" rel="stylesheet" href="../ui.css" />

<script type="text/javascript" src="../src/Q.js"></script>
<script type="text/javascript" src="../src/stl.js"></script>
<script type="text/javascript" src="../src/json2.js"></script>
<script type="text/javascript" src="../src/ajax.js"></script>

<script>
<!--
var urls = ["http://q.wayixia.com/index.html", "http://q.wayixia.com/samples/Q.ajax.htmls"];
for( var j=0; j < 150; j++) {
  urls.push("http://q.wayixia.com/index.html");
  urls.push("http://q.wayixia.com/samples/Q.ajax.html");
}

Q.ready(function() {

  Q.$('ajax-button').onclick = function() {
    //var url = Q.$('url').value;
    //if(url == "") {
    //  Q.$('url').focus();
    //  return;
    //}
    
    var continueError = Q.$('continueError').checked;
    var queue = Q.$('queue').checked;
    
    Q.$('red-object').innerHTML = "";

    for(var i=0; i< urls.length; i++ ) {
      Q.ajaxc({
        command: urls[i],
        continueError: continueError,
        queue: queue,
        oncomplete : function(xmlhttp) {
          Q.$('red-object').innerHTML += "[ok]" + this.command + "<br/>";
        },
        onerror : function( xmlhttp ) {
          Q.$('red-object').innerHTML += "[error]" + this.command + "<br/>";
        }
      });
    }

    console.log("task running");
  };
});
-->
</script>
</head>
<body onmouseup="document.selection && document.selection.empty()" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" oncopy="document.selection.empty()" onselect="document.selection.empty()">
<br>
<h3>Q.ajax </h3>
<hr>

<input id="url" size="100" />
<br>
<br>
<input type="checkbox" id="continueError"/><label for="continueError">continueError</label>
<input type="checkbox" id="queue"/> <label for="queue">queue</label>
<br/>
<br/>
<button id="ajax-button"> do </button>

<br>
<br>
<div id="red-object" style="background-color: yellow;">

</div>
<br/>
<br>
<br>
<br>
<br>
<br>
<br>

</body>
</html>
